package com.wc.alorithm_luogu.P1618_三连击;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/3/18 15:23
 * @description https://www.luogu.com.cn/problem/P1618
 */
public class Main {
    static int A, B, C;
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
//        A = sc.nextInt();
//        B = sc.nextInt();
//        C = sc.nextInt();
        A = 1;
        B = 2;
        C = 3;
        int a, b, c;
        boolean flg = true;
        for (int i = 100; i <= 999; i++) {
            if (A == 0) break;
            a = i;
            if (B * a % A == 0) {
                b = B * a / A;
                if (C * b % B == 0) {
                    c = C * b / B;
                    if (isSuccess(a, b, c)) {
                        flg = false;
                        out.println(a + " " + b + " " + c);
                    }
                }
            }
        }
        if (flg) out.println("No!!!");
        out.flush();
    }

    static boolean isSuccess(int a, int b, int c) {
        if (a >= 1000 || b >= 1000 || c >= 1000) return false;
        boolean[] vis = new boolean[10];
        vis[0] = true;
        while (a > 0) {
            if (!vis[a % 10]) {
                vis[a % 10] = true;
            } else {
                return false;
            }
            a /= 10;
        }

        while (b > 0) {
            if (!vis[b % 10]) {
                vis[b % 10] = true;
            } else {
                return false;
            }
            b /= 10;
        }

        while (c > 0) {
            if (!vis[c % 10]) {
                vis[c % 10] = true;
            } else {
                return false;
            }
            c /= 10;
        }


        return true;
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
